package com;

import java.awt.*;
import java.util.Observable;


/**
 * @author Wys by2018/12/29
 */
public class Shape extends Observable {
    public static final int SIZE=20;  //基础方块大小（cell)
    private int[][] data;//图形
    private Color color;
    private int left=3;   //距离容器左边的距离
    private int top;    //距离容器上边的距离

    /**
     *向下
     */
     public void down(){
         top++;
     }

    /**
     * 向左
     */

    public  void moveLeft(){
        left--;
    }

    /**
     * 向右
     */
    public void moveRight(){
        left++;
    }


    /**
     *旋转
     */
    public void rotate(){
        for(int i=0;i<data.length;i++)
            for (int j=0;j<i;j++){
                int t=data[i][j];
                data[i][j]=data[j][i];
                data[j][i]=t;
            }
            for(int i=0;i<data.length/2;i++)
                for (int j=0;j<data[i].length;j++){
                    int t=data[i][j];
                    data[i][j]=data[data.length-i-1][j];
                    data[data.length-i-1][j]=t;

                }
    }

    public static int getSIZE() {
        return SIZE;
    }

    public int[][] getData() {
        return data;
    }

    public void setData(int[][] data) {
        this.data = data;
    }

    public Color getColor() {
        return color;
    }

    public void setColor(Color color) {
        this.color = color;
    }

    public int getLeft() {
        return left;
    }

    public void setLeft(int left) {
        this.left = left;
    }

    public int getTop() {
        return top;
    }

    public void setTop(int top) {
        this.top = top;
    }


}
